package com.taiji.dicom4cloud.common.mybatisplus.config;

import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName CustomTenantLineHandler
 * @Description
 * @Author HX
 * @Date 2021/9/24 9:53
 **/
public class CustomTenantLineHandler implements TenantLineHandler {

    /**
     * 忽略添加租户ID的表
     */
    private static List<String> IGNORE_TABLE_NAMES = new ArrayList<>();

    @Override
    public Expression getTenantId() {
        return new LongValue(11);
    }

    @Override
    public String getTenantIdColumn() {
        return "org_id";
    }

    @Override
    public boolean ignoreTable(String tableName) {
        //sys_ 表忽略添加orgId
        return tableName.indexOf("sys_")>-1;
    }


}
